package com.jinzhi.jzdoor.examination.controller;

import com.jinzhi.common.annotation.Log;
import com.jinzhi.common.base.BaseController;
import com.jinzhi.common.domain.DictDO;
import com.jinzhi.common.service.DictService;
import com.jinzhi.oss.service.FileService;
import com.jinzhi.sms.support.SmsManager;
import com.jinzhi.sys.service.UserRoleService;
import com.jinzhi.sys.service.UserService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@AllArgsConstructor
@RequestMapping("/examination")
public class LoginController extends BaseController {

	@Autowired
	private FileService fileService;


	@Autowired
	private SmsManager smsService;

	@Autowired
	private UserService userService;

	@Autowired
	private UserRoleService userRoleService;

	@Autowired
	private DictService dictService;

	private static final String O_REG_SMS_PREFIX = "ORTHER_REG_";//其他端


	

	@GetMapping("/lx")
	String lx(Model model) {
		DictDO dic = dictService.findOneByKv("type" , "exam_num");
		DictDO dic1 = dictService.findOneByKv("type" , "send_num");

		model.addAttribute("time" , dic.getValue());
		model.addAttribute("dates" , dic1.getValue());
		return "examinationWeb/login2";
	}


	@GetMapping("/login")
	String login(Model model) {
		DictDO dic = dictService.findOneByKv("type" , "exam_num");
		DictDO dic1 = dictService.findOneByKv("type" , "send_num");

		model.addAttribute("time" , dic.getValue());
		model.addAttribute("dates" , dic1.getValue());
		model.addAttribute("dates" , dic1.getValue());
		return "examinationWeb/login";
	}


	@GetMapping("/login4")
	String login1s(Model model,Integer type) {
		DictDO dic = dictService.findOneByKv("type" , "exam_num");
		DictDO dic1 = dictService.findOneByKv("type" , "send_num");
		/**
		 * （市州组·保育师赛项）湖南省第二届育婴员、保育师职业技能竞赛
		 * （院校组·保育师赛项）湖南省第二届育婴员、保育师职业技能竞赛
		 * （市州组·育婴员赛项）湖南省第二届育婴员、保育师职业技能竞赛
		 * （院校组·育婴员赛项）湖南省第二届育婴员、保育师职业技能竞赛
		 */
		model.addAttribute("time" , dic.getValue());
		model.addAttribute("dates" , dic1.getValue());
		String typeName=null;
		String name=null;
		String img=null;
		String ticketNumber="";
		if(type==1){
			 ticketNumber="1638372311293399041";
			typeName="院校竞赛组";
			name="（院校组·育婴员赛项）湖南省第二届育婴员、保育师职业技能竞赛";
			img="https://jinzhiweiye.oss-cn-hangzhou.aliyuncs.com/2023/315/4.png";
		}else if(type==2){
			typeName="市州竞赛组";
			name="（市州组·育婴员赛项）湖南省第二届育婴员、保育师职业技能竞赛";
			ticketNumber="1638372150269874178";
			img="https://jinzhiweiye.oss-cn-hangzhou.aliyuncs.com/2023/315/3.png";
		}else if(type==3){
			typeName="院校竞赛组";
			name="（院校组·保育师赛项）湖南省第二届育婴员、保育师职业技能竞赛";
			ticketNumber="1638371654075322369";
			img="https://jinzhiweiye.oss-cn-hangzhou.aliyuncs.com/2023/315/2.png";
		}else  if(type==4){
			name="（市州组·保育师赛项）湖南省第二届育婴员、保育师职业技能竞赛";
			typeName="市州竞赛组";
			ticketNumber="1638371457047891969";
			img="https://jinzhiweiye.oss-cn-hangzhou.aliyuncs.com/2023/315/1.png";
		}

		model.addAttribute("name" , name);
		//model.addAttribute("ticketNumber" , ticketNumber);

		model.addAttribute("typeName" , typeName);

		model.addAttribute("img" , img);
		return "newexaminationWeb/login";
	}



	@GetMapping("/startExam")
	String startExam(Model model) {
		return "examinationWeb/startExam";
	}


	@GetMapping("/exam")
	String exam(Model model) {
		return "examinationWeb/exam";
	}


	@GetMapping("/endExam")
	String endExam(Model model,String name,String ticketNumber,String idNumber) {
		model.addAttribute("name",name);
		model.addAttribute("ticketNumber",ticketNumber);
		model.addAttribute("idNumber",idNumber);
		return "examinationWeb/endExam";
	}


	@GetMapping("/abnormal")
	String abnormal(Model model) {
		return "examinationWeb/abnormal";
	}


}
